package com.hq.user.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hq.user.entity.SysMenu;
import com.hq.user.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/sysMenu")
public class SysMenuController {
    @Autowired
    private SysMenuService sysMenuService;

    @GetMapping
    public Object getPage(Page page, SysMenu sysMenu) {
        return sysMenuService.page(page, Wrappers.query(sysMenu));
    }

    @GetMapping("/{id}")
    public Object getById(@PathVariable String id) {
        return sysMenuService.getById(id);
    }

    @PostMapping
    public Object Save(@RequestBody SysMenu sysMenu) {
        return sysMenuService.save(sysMenu);
    }

    @PutMapping
    public Object update(@RequestBody SysMenu sysMenu) {
        return sysMenuService.updateById(sysMenu);
    }

    @DeleteMapping("/{id}")
    public Object remove(@PathVariable String id) {
        return sysMenuService.removeById(id);
    }
}
